import {html, TemplateResult} from 'lit';
import type {Meta, StoryObj} from '@storybook/web-components';
import "../../../echarts/bar/lit-waterfall.ts"
import {WaterfallProps} from "../../../echarts/bar/lit-waterfall.ts";

const meta: Meta<WaterfallProps> = {
    title: 'Echarts/LitWaterfall',
    tags: ['autodocs'],
    parameters: {
        docs: {
            description: {
                component: 'tooltip，以及其他各类事件暂时无法在storybook中使用，具体请参考echarts的文档',
            },
        }
    },
    render: (args: WaterfallProps): TemplateResult => {
        return html`<lit-waterfall
            .chartId=${args.chartId}
            .width=${args.width}
            .height=${args.height}
            .title=${args.title}
            .grid=${args.grid}
            .seriesName=${args.seriesName}
            .xAxisData=${args.xAxisData}
            .seriesData=${args.seriesData}
        />`;
    },
    argTypes: {
        chartId: { control: 'text' },
        width: { control: 'text' },
        height: { control: 'text' },
        title: { control: 'object' },
        grid: { control: 'object' },
        seriesName: { control: 'text' },
        xAxisData: { control: 'object' },
        seriesData: { control: 'object' },
    },
}

export default meta;
type Story = StoryObj<WaterfallProps>;

export const Default: Story = {
    args: {
        chartId: 'waterfall-chart',
        width: '1200px',
        height: '600px',
        title: {
            text: 'Waterfall Chart',
            subtext: 'Living Expenses in Shenzhen'
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        seriesName: 'Life Cost',
        xAxisData: ['Total', 'Rent', 'Utilities', 'Transportation', 'Meals', 'Other'],
        seriesData: [[0, 1700, 1400, 1200, 300, 0], [2900, 1200, 300, 200, 900, 300]],
    },
}
